If build-time tests fail, try 4 more times
authorSimon McVittie <smcv@debian.org>
Sun, 12 Jun 2016 13:50:51 +0000 (09:50 -0400)
committerSimon McVittie <smcv@debian.org>
Sun, 12 Jun 2016 17:15:34 +0000 (13:15 -0400)
To get an idea of whether the failure is reproducible.

debian/changelog
debian/test.sh

index 083c30b77565d0302e43b7e374de5e40edb3258e..4fb025cbdb7b06735cc9acd74e976dd630d3f69d 100644 (file)
@@ -6,6 +6,8 @@ ostree (2016.5-4) UNRELEASED; urgency=medium
   * Build-depend on procps, used to check for leaked processes
   * debian/test.sh: factor out our dh_auto_test wrapper, and clean
     up any stray processes even if the test fails
+  * If build-time tests fail, try 4 more times to get an idea of
+    whether the failure is reproducible
 
  -- Simon McVittie <smcv@debian.org>  Sat, 11 Jun 2016 19:52:40 +0100
 
index 69e4f8dfb95614c40eab0014c2c9c85413c7c212..e2ac075c65e5c18ae936ed62ab98ddf0ea22f521 100755 (executable)
@@ -4,8 +4,19 @@ set -e
 
 export VERBOSE=1
 
-exit_status=0
-dh_auto_test || exit_status=1
+try_tests=5
+
+failed=0
+make check || failed=1
+
+if [ "$failed" -gt 0 ]; then
+    echo "Test failed! Checking how reproducible it is..."
+    for i in $(seq 1 "$(( $try_tests - 1 ))"); do
+        if ! make check; then
+            failed=$(( $failed + 1 ))
+        fi
+    done
+fi
 
 pkill --full "gpg-agent --homedir /var/tmp/tap-test\\.[^/]+/.*" || :
 
@@ -15,6 +26,11 @@ if pgrep lt-ostree || pgrep --full "gpg-agent --homedir /var/tmp/tap-test."; the
     pgrep lt-ostree | xargs --no-run-if-empty ps ww
 fi
 
-exit $exit_status
+if [ "$failed" -gt 0 ]; then
+    echo "Failed $failed out of $try_tests test runs"
+    exit 1
+fi
+
+exit 0
 
 # vim:set et sw=4 sts=4: